﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>忘记密码</title>
    
    <link rel="stylesheet" href="css/忘记密码.css">

    <script src="../首页附件/js/jquery-1.12.4.js"></script>
    <script src="js/前后端数据交互.js"></script>
</head>

<body>
    <h1>好恰恰重置密码中心</h1>
    <div class="container">
        <h2 style="text-align: center;">重置密码</h2>
        <form>
            <label>请输入您的新密码:</label>
            <input type="text" id="password" name="password" required>
            <label>请再次确认密码:</label>
            <input type="text" id="confirm_password" name="confirm_password" required>
            <button id="submit">提交</button>
        </form>
    </div>

    <script>
        if (!sessionStorage.getItem('forget_user')) { // 找不到username
            window.history.back(); // 回退到原来的页面
            alert("非法访问！请先登录!");
        }

        // 事件监听器
        document.getElementById('submit').addEventListener('click', function (e) {
            e.preventDefault(); // 阻止表单默认提交

            const password = $('#password').val();
            const confirm_password = $('#confirm_password').val();

            reset_pwd(password, confirm_password); // 调用函数并传递输入值
        });

        getRequest('greset');
    </script>
</body>

</html>